<?php
/*
Bitsand - a web-based booking system for LRP events
Copyright (C) 2006 Russell Peter Phillips

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

//Do not need login check for this page
$bLoginCheck = False;

include ('inc/inc_head_db.php');
include ('inc/inc_head_html.php');

//Get list of players that have paid
$db_prefix = DB_PREFIX;
$sql = "SELECT plFirstName, " .
	"plSurname, " .
	"plBookAs, " .
	"chName, chGroupSel, chGroupText, " .
	"bkDatePaymentConfirmed " .
	"FROM {$db_prefix}players, {$db_prefix}characters, {$db_prefix}bookings " .
	"WHERE plPlayerID = chPlayerID AND chPlayerID = bkPlayerID AND bkDatePaymentConfirmed <> '' AND bkDatePaymentConfirmed <> '0000-00-00'";

$result = ba_db_query ($link, $sql);
?>
<script src="inc/sorttable.js" type="text/javascript"></script>

<h1><?php echo TITLE?> - Bookings</h1>

<p>
The people below have confirmed IC &amp; OOC details, and been marked as paid. Click on a column header to sort by that column.
</p>

<table border = '1' class="sortable">
<tr>
<th>OOC First Name</th>
<th>OOC Surname</th>
<th>IC Name</th>
<?php
if (LIST_GROUPS_LABEL != '')
	echo "<th>Group</th>\n";
?>
<th>Booking As</th>
</tr>

<?php
while ($row = ba_db_fetch_assoc ($result)) {
	echo "<tr class = 'highlight'>\n";
	echo "<td>" . htmlentities (stripslashes ($row ['plFirstName'])) . "</td>\n";
	echo "<td>" . htmlentities (stripslashes ($row ['plSurname'])) . "</td>\n";
	echo "<td>" . htmlentities (stripslashes ($row ['chName'])) . "</td>\n";
	if (LIST_GROUPS_LABEL != '') {
		echo "<td>\n";
		if ($row ['chGroupText'] == 'Enter name here if not in above list' || $row ['chGroupText'] == '')
			echo htmlentities (stripslashes ($row ['chGroupSel']));
		else
			echo "Other (" . htmlentities (stripslashes ($row ['chGroupText'])) . ")";
		echo "</td>\n";
	}
	echo "<td>" . htmlentities (stripslashes ($row ['plBookAs'])) . "</td>\n</tr>\n";
}
?>

</table>

<?php
include ('inc/inc_foot.php');
?>
